<template>
	<view class="list-item">
		<scroll-view scroll-y="true" class="item-scroll" @scrolltolower="loadMore">
			<ItemCard @saveHistory="$emit('saveHistory')" class="item" v-for="item in list" 
			:key="item._id" :item="item"></ItemCard>
			<uni-load-more v-if="isShowLoading && (!list.length || list.length > 7) "  :status="more"></uni-load-more>
		</scroll-view>
	</view>
</template>

<script>
	export default {
		name:"ListItem",
		props:{
			list:{
				type: Array,
				default(){
					return []
				}
			},
			more: {
				type:String,
				default:'more'
			},
			isShowLoading: {
				type: Boolean,
				default: true
			}
		},
		methods:{
			loadMore() {
				this.$emit('loadmore')
			}
		}
	}
</script>

<style lang="scss">
.list-item{
	height: 100%;
	.item-scroll{
		overflow: hidden;
		height: 100%;
	}
}
</style>